#!/bin/sh

source ./projects-list.sh

function update_proj() {
	local project=$1
	local fconfig=configs/$project.json
	if [ -f "$fconfig" ]; then
		python update-project.py -p $project -c $fconfig -o ../projects
	else
		echo "project: $project has no config json"
	fi
}

if [ $# -gt 0 ]; then
	for arg in $@; do
		update_proj $arg
	done
	exit 0
fi

#for index in ${!initprojects[@]}; do
#	update_proj ${initprojects[$index]}
#done

for index in ${!projects[@]}; do
	update_proj ${projects[$index]}
done
